BP008: Replace con* functions by Annotated versions
constr(min_length=1)はAnnotated[str, StringConstraints(min_length=1)]となる
You can also use pydantic.StringConstraints in Annotated instead of constr for better compatibility with type checkers and more flexibility in nesting within other types:
以下への改善なのかな
code:mypy_message
error: Invalid type comment or annotation valid-type note: Suggestion: use constr... instead of constr(...) error: Invalid type comment or annotation valid-type note: Suggestion: use conlist... instead of conlist(...) from pydantic import StringConstraintsできない(Pydantic v2.0.3)
上のプルリクエストはマージされているが、ドキュメントに反映されただけでリリースされていない